<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>个人中心</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<link rel="stylesheet" href="../../css/mui.min.css">
		<style>
			html,
			body {
				background-color: #efeff4;
			}
			.mui-views,
			.mui-view,
			.mui-pages,
			.mui-page,
			.mui-page-content {
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				bottom: 0;
				width: 100%;
				height: 100%;
				background-color: #efeff4;
			}
			.mui-pages {
				top: 46px;
				height: auto;
			}
			.mui-scroll-wrapper,
			.mui-scroll {
				background-color: #efeff4;
			}
			.mui-page.mui-transitioning {
				-webkit-transition: -webkit-transform 200ms ease;
				transition: transform 200ms ease;
			}
			.mui-page-left {
				-webkit-transform: translate3d(0, 0, 0);
				transform: translate3d(0, 0, 0);
			}
			.mui-ios .mui-page-left {
				-webkit-transform: translate3d(-20%, 0, 0);
				transform: translate3d(-20%, 0, 0);
			}
			.mui-navbar {
				position: fixed;
				right: 0;
				left: 0;
				z-index: 10;
				height: 44px;
				background-color: #f7f7f8;
			}
			.mui-navbar .mui-bar {
				position: absolute;
				background: transparent;
				text-align: center;
			}
			.mui-android .mui-navbar-inner.mui-navbar-left {
				opacity: 0;
			}
			.mui-ios .mui-navbar-left .mui-left,
			.mui-ios .mui-navbar-left .mui-center,
			.mui-ios .mui-navbar-left .mui-right {
				opacity: 0;
			}
			.mui-navbar .mui-btn-nav {
				-webkit-transition: none;
				transition: none;
				-webkit-transition-duration: .0s;
				transition-duration: .0s;
			}
			.mui-navbar .mui-bar .mui-title {
				display: inline-block;
				position: static;
				width: auto;
			}
			.mui-page-shadow {
				position: absolute;
				right: 100%;
				top: 0;
				width: 16px;
				height: 100%;
				z-index: -1;
				content: '';
			}
			.mui-page-shadow {
				background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
				background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 10%, rgba(0, 0, 0, .01) 50%, rgba(0, 0, 0, .2) 100%);
			}
			.mui-navbar-inner.mui-transitioning,
			.mui-navbar-inner .mui-transitioning {
				-webkit-transition: opacity 200ms ease, -webkit-transform 200ms ease;
				transition: opacity 200ms ease, transform 200ms ease;
			}
			.mui-page {
				display: none;
			}
			.mui-pages .mui-page {
				display: block;
			}
			.mui-page .mui-table-view:first-child {
				margin-top: 15px;
			}
			.mui-page .mui-table-view:last-child {
				margin-bottom: 30px;
			}
			.mui-table-view {
				margin-top: 20px;
			}
			.mui-table-view:after {
				height: 0;
			}
			.mui-table-view span.mui-pull-right {
				color: #999;
			}
			.mui-table-view-divider {
				background-color: #efeff4;
				font-size: 14px;
			}
			.mui-table-view-divider:before,
			.mui-table-view-divider:after {
				height: 0;
			}
			.mui-content-padded {
				margin: 10px 0px;
			}
			.mui-locker {
				margin: 35px auto;
				display: none;
			}
		</style>
		<!--<link rel="stylesheet" type="text/css" href="./css/feedback-page.css" />-->
	</head>

	<body>
		<!--&lt;!&ndash;页面主结构开始&ndash;&gt;-->
		<!--<div id="app" class="mui-views">-->
			<!--<div class="mui-view">-->
				<!--<div class="mui-navbar">-->
				<!--</div>-->
				<!--<div class="mui-pages">-->
				<!--</div>-->
			<!--</div>-->
		<!--</div>-->
		<!--&lt;!&ndash;页面主结构结束&ndash;&gt;-->
		<!--&lt;!&ndash;单页面开始&ndash;&gt;-->
		<!--<div id="setting" class="mui-page">-->
			<!--页面标题栏开始-->
			<!--<div class="mui-navbar-inner mui-bar mui-bar-nav">-->
				<!--<button type="button" class="mui-left mui-action-back mui-btn  mui-btn-link mui-btn-nav mui-pull-left">-->
					<!--<span class="mui-icon mui-icon-left-nav"></span>-->
				<!--</button>-->
				<!--<h1 class="mui-center mui-title">个人中心</h1>-->
			<!--</div>-->
			<!--页面标题栏结束-->
			<!--页面主内容区开始-->
			<div class="mui-page-content">
				<form id='login-form' class="mui-input-group">
					<input id='id' type="hidden" class="mui-input-clear mui-input">
					<div class="mui-input-row">
						<label>用户名</label>
						<input disabled="true" id='name' type="text" class="mui-input-clear mui-input">
					</div>
					<div class="mui-input-row">
						<label>所属机构</label>
						<input disabled="true" id='org' type="text" class="mui-input-clear mui-input">
					</div>
					<div class="mui-input-row">
						<label>机构管理员</label>
						<input disabled="true" id='belong' type="text" class="mui-input-clear mui-input">
					</div>
					<div class="mui-input-row">
						<label>剩余分</label>
						<input disabled="true" id='restscore' type="text" class="mui-input-clear mui-input">
					</div>
				</form>
				
				<div class="mui-content-padded" align="center">
					<button id='betRecord' class="mui-btn mui-btn-block mui-btn-primary">下注记录</button>
					<button id='chargeRecord' class="mui-btn mui-btn-block mui-btn-primary">充值记录</button>
					<ul class="mui-table-view">
						<li class="mui-table-view-cell" style="text-align: center;">
							<a id='exit'>退出</a>
						</li>
					</ul>
				</div>
			</div>
			<!--页面主内容区结束-->
		<!--</div>-->

	</body>
	<script src="../../js/mui.min.js"></script>
	<script src="../../js/mui.view.js "></script>
	<script src='../../js/jquery-1.10.2.min.js'></script>
	<script src="../../js/app.js"></script>
	<script>
		var chargeUserInfo;
		var nameBox = document.getElementById("name");
		var orgBox = document.getElementById("org");
		var belongBox = document.getElementById("belong");
		var restscoreBox = document.getElementById("restscore");
		mui.init();
		//********************
		(function($) {
			//加载用户详细信息
			loadUserDetail();
		})(mui);
		
		var userid;
		function loadUserDetail(){
			userid = localStorage.getItem("userid");

			mui.post(localStorage.getItem("serverPath")+"/appClient/queryUserDetailById.shtml",{
				id: userid
			},function(data){
				if('success' == data.result){
					nameBox.value=data.datas.name;
					orgBox.value=data.datas.org_name;
					belongBox.value=data.datas.adminname;
					restscoreBox.value=data.datas.rest_score;
				} else{
					mui.toast(data.info);
				}
			},'json');
		}
		
		/**
		 * 下注记录按钮事件
		 */
		document.getElementById("betRecord").addEventListener('tap', function() {
			
		});
		
		/**
		 * 充值记录按钮点击事件
		 */
		document.getElementById("chargeRecord").addEventListener('tap', function() {
			var chargeUserInfo = {
				id: userid
			};
			localStorage.setItem('$chargeUserInfo', JSON.stringify(chargeUserInfo));
			
			mui.openWindow({
				url: 'userChargeList_main.html',
				id: 'userChargeList_main',
				extras:{
					id: userid
				},
				show: {
					aniShow: 'pop-in'
				},
				waiting: {
					autoShow: false
				}
			});
		});
		
		//退出操作******************
		document.getElementById('exit').addEventListener('tap', function() {
			if (mui.os.ios) {
				app.setState({});
				mui.openWindow({
					url: 'login.html',
					id: 'login',
					show: {
						aniShow: 'pop-in'
					},
					waiting: {
						autoShow: false
					}
				});
				return;
			}
			var btnArray = [{
				title: "注销当前账号"
			}, {
				title: "直接关闭应用"
			}];
			plus.nativeUI.actionSheet({
				cancel: "取消",
				buttons: btnArray
			}, function(event) {
				var index = event.index;
				switch (index) {
					case 1:
						//注销账号
						app.setState({});
						logoutFromServer();
						/*
						 * 注意：
						 * 1、因本示例应用启动页就是登录页面，因此注册成功后，直接显示登录页即可；
						 * 2、如果真实案例中，启动页不是登录页，则需修改，使用mui.openWindow打开真实的登录页面
						 */
						plus.webview.getLaunchWebview().show("pop-in");
						//若启动页不是登录页，则需通过如下方式打开登录页
//						mui.openWindow({
//							url: 'login.html',
//							id: 'login',
//							show: {
//								aniShow: 'pop-in'
//							}
//						});
						break;
					case 2:
						plus.runtime.quit();
						logoutFromServer();
						break;
				}
			});
		}, false);
		
		//在服务器上注销登录
		function logoutFromServer(){
			mui.post(localStorage.getItem("serverPath")+"/appClient/apploginOut.shtml",{
				},function(data){

				},'json');
		}
	</script>

</html>